import { getCompany } from '@/api/company/company.js'
const state = {
  detail: {
    companydescription: '',
    companyimage: '',
    companyname: '',
    douyin: '',
    douyinimage: '',
    gongzhonghao: '',
    gongzhonghaoimage: '',
    logo: '',
    logofu: '',
    othersharetitle: '',
    remark: '',
    sharedescription: '',
    sharetitle: '',
    wechat: '',
    wechatimage: '',
    weibo: '',
    weiboimage: '',
  }
}

const mutations = {
  SET_DETAIL: (state, detail) => {
    state.detail = detail
    console.log(state.detail, '公司详情')
  },
}

const actions = {
  setBasic({ commit }) {
    return new Promise((resolve, reject) => {
      getCompany(1).then(res => {
        commit('SET_DETAIL', res.data)
        resolve(res)
      }).catch(error => {
        reject(error)
      })
    })
  },
  
}
const getters = {
  companydescription: state => state.detail.companydescription,
  companyimage: state => state.detail.companyimage,
  companyname: state => state.detail.companyname,
  douyin: state => state.detail.douyin,
  douyinimage: state => state.detail.douyinimage,
  gongzhonghao: state => state.detail.gongzhonghao,
  gongzhonghaoimage: state => state.detail.gongzhonghaoimage,
  logo: state => state.detail.logo,
  logofu: state => state.detail.logofu,
  othersharetitle: state => state.detail.othersharetitle,
  remark: state => state.detail.remark,
  sharedescription: state => state.detail.sharedescription,
  sharetitle: state => state.detail.sharetitle,
  wechat: state => state.detail.wechat,
  wechatimage: state => state.detail.wechatimage,
  weibo: state => state.detail.weibo,
  weiboimage: state => state.detail.weiboimage,
}
export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
